//
//  main.m
//  02_分数
//
//  Created by dllo on 16/7/5.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Fraction.h"

int main(int argc, const char * argv[]) {
    
    Fraction *f1 = [Fraction fractionWithNumerator:2 denominator:0];
    Fraction *f2 = [[Fraction alloc] initWithNumerator:2 denominator:4];
    NSLog(@"f1 = %@, f2 = %@", f1, f2);
    
    NSLog(@"加减乘除:");
    NSLog(@"f1 + f2 = %@", [f1 add:f2]);
    NSLog(@"f1 - f2 = %@", [f1 subtract:f2]);
    NSLog(@"f1 * f2 = %@", [f1 multiply:f2]);
    NSLog(@"f1 ÷ f2 = %@", [f1 divide:f2]);
    
    NSLog(@"比较大小:");
    if ([f1 compare:f2] > 0) {
        NSLog(@"f1比f2大");
    } else if ([f1 compare:f2] == 0) {
        NSLog(@"f1与f2相等");
    } else {
        NSLog(@"f1比f2小");
    }
    
    NSLog(@"约分后:");
    [f1 reduce];
    [f2 reduce];
    NSLog(@"f1 = %@, f2 = %@", f1, f2);
    
    
    return 0;
}
